package cn.zkteco.doordu.utils;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by Administrator on 2017/11/21.
 */

public class DbUtils {

    public static SharedPreferences sp;

    public static void saveKey(Context context, String key) {
        sp = context.getSharedPreferences("ble_key", 0);
        SharedPreferences.Editor editor = sp.edit();

        editor.putString("key", key);
        editor.commit();
    }

    public static String getKey(Context context) {
        //1、获取Preferences
        sp = context.getSharedPreferences("ble_key", 0);
        //2、取出数据
        String key = sp.getString("key","ffffffffffffffffffffffffffffffff");

        return key.substring(0,24);
    }
}
